package com.polarrose.wsf.client;

import java.util.ArrayList;
import java.util.List;

public class RemoteCallErrors {

	private List<RemoteCallError> errors = new ArrayList<RemoteCallError>();

	public List<RemoteCallError> getErrors() {
		if (errors == null) {
			errors = new ArrayList<RemoteCallError>();
		}
		return errors;
	}

	public void addInvocationError(RemoteCallError error) {
		if (errors == null) {
			errors = new ArrayList<RemoteCallError>();
		}
		errors.add(error);
	}

	public void setErrors(List<RemoteCallError> errors) {
		this.errors = errors;
	}

	@Override
	public String toString() {
		StringBuilder buff = new StringBuilder();
		buff.append("RemoteCallsErrors[\n");
		for (RemoteCallError remoteCallError : getErrors()) {
			buff.append("\t").append(remoteCallError).append("\n");
		}
		buff.append("]");
		return buff.toString();
	}
}
